package com.puppet.building.mapper;

import com.puppet.building.pojo.Building;
import com.puppet.building.pojo.Owner;
import com.puppet.building.pojo.vo.OwnerVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface OwnerMapper {
    @Select("select * from owner_info")
    List<Owner> getAllOwner();

    @Insert("insert into owner_info values (default,#{name},#{telephone},#{gender},#{idCard},#{remark},#{houseId})")
    Integer addNewOwner(Owner owner);

    @Select("select * from owner_info where id=#{id}")
    Owner getAllOwnerById(Integer id);

    @Update("update owner_info set name=#{name},telephone=#{telephone},gender=#{gender},idcard=#{idCard},remark=#{remark},house_id=#{houseId} where id=#{id}")
    Integer updateOwner(Owner owner);

    @Select("select id,name from owner_info")
    List<OwnerVO> getOwnerNameAnId();
}
